﻿using System;
using System.Windows.Forms;
using CodeToCaml.Cons.Models;
using CodeToCaml.SpTypes;

// ReSharper disable All

namespace CodeToCaml.Cons
{
    class Program
    {
        [STAThread]
        static void Main()
        {
            var caml = new Caml<Employee> {ViewScope = SpViewScope.RecursiveAll}
                .Select(s => new {s.EmployeeId, s.FirstName, s.LastName})
                .Where(f => f.FirstName == "Handy")
                .OrderBy(o => o.EmployeeId)
                .Take(100);

            caml.AndAlso(f => f.Salary > 2500);
            caml.OrElse(f => f.YearHired > 2010);
            
            // Copy output to clipboard!
            // Note: you can use Notepad++ with XML tools plugin to pretty print the CAML string.
            Clipboard.SetData(DataFormats.Text, caml.ToString());

            Console.WriteLine(caml);
            Console.ReadLine();
        }
    }
}
